package com.jcl.core.utils;

import java.io.UnsupportedEncodingException;
import java.util.Base64;

/**
 * @ClassName ChannelUtils
 * @Author yyliu
 * @Date 2018/12/24 15:58
 * @Version 1.0
 **/
public class ChannelUtils {

    public static String decodeResumeExternalMsg(String content){
        String context = null;
        if(null != content){
            try {
                byte[] bytes = Base64.getDecoder().decode(content);
                context = new String(bytes, "utf-8");
            } catch (UnsupportedEncodingException e) {
                e.printStackTrace();
            }
        }
        return context;
    }

    public static String encodeResumeExternalMsg(String content){
        if(null != content){
            try {
                String _context = Base64.getEncoder().encodeToString(content.getBytes("utf-8"));
                return _context;
            } catch (UnsupportedEncodingException e) {
                e.printStackTrace();
            }
        }
        return null;
    }
}
